#ifndef RDESKTOPS_H
#define RDESKTOPS_H


#include <wx/wx.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/menu.h>
#include <wx/textctrl.h>
#include <wx/splitter.h>
#include <wx/listbox.h>
#include <wx/toolbar.h>
#include <wx/panel.h>
#include <wx/button.h>
#include <wx/frame.h>
#include <wx/statusbr.h>
#include <wx/stdpaths.h>
#include <wx/dirdlg.h>
#include <wx/checkbox.h>
#include <wx/taskbar.h>
#include <wx/snglinst.h>

#include <algorithm>

#include "FsProfileManager.h"

class RDesktops: public wxFrame
{
    public:

        RDesktops();

        void setSingleInstanceChecker(wxSingleInstanceChecker* singleInstanceChecker) { m_singleInstanceChecker = singleInstanceChecker; }
        void setTaskBarIcon(wxTaskBarIcon* taskBarIcon) { m_taskBarIcon = taskBarIcon; }

        void getProfileList(wxArrayString& asFile);
        virtual bool execute(string strProfileName);
        void quit();

    protected:

        virtual wxListBox* getProfileListBox() = 0;
        virtual wxTextCtrl* getNameTextCtrl() = 0;
        virtual wxTextCtrl* getHostTextCtrl() = 0;
        virtual wxTextCtrl* getDomainTextCtrl() = 0;
        virtual wxTextCtrl* getUserTextCtrl() = 0;
        virtual wxTextCtrl* getPasswordTextCtrl() = 0;
        virtual wxCheckBox* getAttachConsoleCheckBox() = 0;

        virtual void initialize();

        virtual void onProfileSelect(wxCommandEvent& event);
        virtual void onProfileSave(wxCommandEvent& event);
        virtual void onProfileConnect(wxCommandEvent& event);

    private:

        void loadProfileList();

        wxSingleInstanceChecker* m_singleInstanceChecker;
        wxTaskBarIcon* m_taskBarIcon;
        ProfileManager* profileManager;

        bool bClosing;
};

inline wxString getWxString(string str)
{
    return wxString(str.c_str(), wxConvUTF8);
}

inline string getStdString(wxString str)
{
    return string( str.mb_str() );
}

inline wxString getCmdPath(string strStoreDir, wxString strCmd)
{
    return getWxString(strStoreDir) + L"/" + strCmd;
}

inline wxString getUserDir()
{
    return wxStandardPaths::Get().GetUserConfigDir();
}


#endif
